#include <iostream>
using namespace std;

enum privileges
{
    PUB,
    PRI,
    PRO
}

class base
{
private:
    int m = 0;

protected:
    int p = 0;

public:
    int q = 0;
    base() : m(0), p(0), q(0){};
    base(int _m) : m(_m), p(0), q(0){};
    base(int _m, int _p, int _q) : m(_m), p(_p), q(_q){};
    ~base()
    {
        cout << "base destructor called" << endl;
    }
    int operator+(int n)
    {
        cout << "+" << endl;
        m = m + n;
        return m;
    }
    base(const base &obj); // 拷贝构造

    void show_num(void)
    {
        cout << "m = " << m << endl;
    }
};

class derived : public base
{
private:
    int n = 0;

public:
    void show(int x)
    {
        n = x;
        cout << "n = " << n << endl;
    }
};

int main()
{
    cout << "base class" << endl;
    base b;
    b + 10;
    b.show_num();
    cout << "derived class" << endl;
    derived der;
    //derived der(99);
    der.show_num();
    der + 10;
    der.show_num();
    der.show(10);
    cout << "end of main()" << endl;
    return 0;
}